package com.face.controller;

import com.face.common.Result;
import com.face.entity.UpdateLog;
import com.face.service.UpdateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * ClassName: UpdateController <br/>
 * Description: <br/>
 * date: 2019/12/25 19:54<br/>
 *
 * @author geyee<br />
 */
@RestController
@RequestMapping("/update")
public class UpdateController {

    @Autowired
    private UpdateService updateService;

    @GetMapping("/check")
    public Result checkUpdate(@NotNull String version) {
        UpdateLog updateLog = updateService.checkUpdate(version);
        if (updateLog != null) {
            return Result.success(updateLog);
        }
        return Result.success();
    }
}
